Class DB

Description

The main "DB" class is simply a container class with some static methods for creating DB objects as well as some utility functions common to all parts of DB.

Located in /adodb/adodb-pear.inc.php (line 90)


	
			
Method Summary
int apiVersion ()
bool assertExtension ($name $name)
object a &connect ($dsn $dsn, [$options $options = false])
object a &factory ($type $type)
bool isError ($value $value)
bool isWarning ($value $value)
array parseDSN ($dsn $dsn)
Methods
apiVersion (line 177)

Return the DB API version

  • return: the DB API version number
int apiVersion ()
assertExtension (line 336)

Load a PHP database extension if it is not loaded already.

  • return: true if the extension was already or successfully loaded, false if it could not be loaded
  • access: public
bool assertExtension ($name $name)
  • $name $name: the base name of the extension (without the .so or .dll suffix)
connect (line 136)

Create a new DB object and connect to the specified database

  • return: newly created DB connection object, or a DB error object on error
  • see: DB::isError
  • see: DB::parseDSN
object a &connect ($dsn $dsn, [$options $options = false])
  • $dsn $dsn: mixed "data source name", see the DB::parseDSN method for a description of the dsn format. Can also be specified as an array of the format returned by DB::parseDSN.
  • $options $options: mixed if boolean (or scalar), tells whether this connection should be persistent (for backends that support this). This parameter can also be an array of options, see DB_common::setOption for more information on connection options.
factory (line 101)

Create a new DB object for the specified database type

  • return: newly created DB object, or a DB error code on error
object a &factory ($type $type)
  • $type $type: string database type, for example "mysql"
isError (line 189)

Tell whether a result code from a DB method is an error

  • return: whether $value is an error
bool isError ($value $value)
  • $value $value: int result code
isWarning (line 206)

Tell whether a result code from a DB method is a warning.

Warnings differ from errors in that they are generated by DB, and are not fatal.

  • return: whether $value is a warning
bool isWarning ($value $value)
  • $value $value: mixed result value
parseDSN (line 245)

Parse a data source name

  • return:

    an associative array with the following keys:

    phptype: Database backend used in PHP (mysql, odbc etc.) dbsyntax: Database used with regards to SQL syntax etc. protocol: Communication protocol to use (tcp, unix etc.) hostspec: Host specification (hostname[:port]) database: Database to use on the DBMS server username: User name for login password: Password for login

    The format of the supplied DSN is in its fullest form:

    phptype(dbsyntax)://username:password@protocol+hostspec/database

    Most variations are allowed:

    phptype://username:password@protocol+hostspec:110//usr/db_file.db phptype://username:password@hostspec/database_name phptype://username:password@hostspec phptype://username@hostspec phptype://hostspec/database phptype://hostspec phptype(dbsyntax) phptype

  • author: Tomas V.V.Cox <cox@idecnet.com>
array parseDSN ($dsn $dsn)
  • $dsn $dsn: string Data Source Name to be parsed

Documentation generated on Thu, 04 Sep 2008 16:14:43 +0400 by phpDocumentor 1.3.0RC3